package net.jcip.examples;

public class SyncCache<K,V> implements Cache<K,V>{
	K key;
	V value;
	
	public SyncCache(K key, V value) {
		this.key = key;
		this.value = value;
	}

	
	
	public synchronized V get( K key){
		if (this.key.equals(key)){
			return this.value;
		} else {
			return null;
		}
	}
	
	public synchronized void put(K key, V val){
		this.key = key;
		this.value = val;
			
	}
	
}
